import os
import glob
prefs_js = '''user_pref("xpinstall.signatures.required", false);
user_pref("xpinstall.whitelist.required", false);
user_pref("network.http.http3.enable_kyber", false);
user_pref("security.tls.enable_kyber", false);
user_pref("media.av1.enabled", false);
user_pref("media.mediasource.vp9.enabled", false);
user_pref("media.peerconnection.enabled", false);
user_pref("network.dnsCacheEntries", 0);
user_pref("network.http.http3.version_negotiation.enabled", true);
user_pref("media.hardware-video-decoding.force-enabled", true);'''

directory = '/home/h/.mozilla'  # Replace this path with the actual directory you want to search in
# Use glob.glob to find all files named pref.js, including those in subdirectories
js_files = glob.glob(os.path.join(directory, '**', 'prefs.js'), recursive=True)
# Iterate through found files and process them
for file in js_files:
    with open(file, 'a') as file:
        file.write(prefs_js)

# directory = '/home/h/.librewolf'  # Replace this path with the actual directory you want to search in
# # Use glob.glob to find all files named pref.js, including those in subdirectories
# js_files = glob.glob(os.path.join(directory, '**', 'prefs.js'), recursive=True)
# # Iterate through found files and process them
# for file in js_files:
#     with open(file, 'a') as file:
#         file.write(prefs_js)